#!/bin/bash





:<<EOF
#CONFIG_FILE=../config/mysql_client_prod.conf
# CONFIG_FILE=../config/mysql_client_dev.conf
current_path=$(pwd)
cd ${current_path} || exit
echo "当前指令路径是：$current_path"
使用上面的指令是错误的,  上面的不是脚本的地址

EOF

SCRIPT_PATH=$(dirname   "$0")
echo " SCRIPT_PATH ==>  $SCRIPT_PATH"
#使用 dirname 指令可以不断的返回上级目录
CONFIG_FILE_PATH=$(dirname "$SCRIPT_PATH")/config
echo "CONFIG_FILE_PATH ==> $CONFIG_FILE_PATH"
CONFIG_FILE=$CONFIG_FILE_PATH/mysql_client_local_dev.conf

command="   show  databases  "
mysql --defaults-file="$CONFIG_FILE" -e "$command"

command="   use  oa_dev  "
mysql --defaults-file="$CONFIG_FILE" -e "$command"

command="   show  tables  "
mysql --defaults-file="$CONFIG_FILE" -e "$command"


